<?php if (!defined('BASEPATH')) exit('No direct access allowed.');
/**
 *---------------------------------------------------------------
 * 框架扩展类: MY_Loader
 *---------------------------------------------------------------
 *
 */
class MY_Loader extends CI_Loader
{
    // ------------------------------------------------------------------------
    public function __construct()
    {
        parent::__construct();
        //配置模板路径
        $this->_ci_view_paths = array(
            VIEWPATH . '/' => TRUE,
        );
    }
    // ------------------------------------------------------------------------

    /**
     * 设置前台模板路径
     * @param string $themeDirname
     */
    public function setFrontTheme($themeDirname = 'default')
    {
        if( empty($themeDirname) ){
            return false;
        }

        $this->_ci_view_paths = array(
            VIEWPATH . $themeDirname . '/' => TRUE,
        );
    }
    // ------------------------------------------------------------------------

    /**
     * 设置后台模板路径
     * @param string $themeDirname
     */
    public function setAdminTheme($themeDirname = 'admins')
    {
        if( empty($themeDirname) ){
            return false;
        }
        $this->_ci_view_paths = array(
            VIEWPATH . $themeDirname . '/' => TRUE,
        );
    }
    // ------------------------------------------------------------------------

    /**
     * 插件
     * @param $name
     */
    public function plugin($name)
    {
        $this->add_package_path(
            APPPATH . 'plugins/' . $name . '/'
        );
        $this->library($name);
        //$ci= &get_instance();
        //$ci->config->load($config);
    }
    // ------------------------------------------------------------------------

}   //CLASS END
